// 获取录音对象
const recorder = uni.getRecorderManager();
// 开始录音
function start(options){
  recorder.start(options);
}
// 结束录音
function stop(){
  recorder.stop();
}
function onStop(callback){
	console.log(2222);
	console.log(callback);
  if(callback && typeof callback == 'function'){
	  console.log(3333);
    recorder.onStop(callback);
  } else {
	  console.log(4444);
    return new Promise((res) => {
		console.log(5555);
      recorder.onStop(result => {
		  console.log(6666);
        res(result);
      })
	  recorder.onError(e=>{
		  console.log(e);
	  })
    })
  }
}

export default {
  start, stop, onStop, 
}